<?php
include_once "../header1.php";
?>
<link rel="stylesheet" href="style_exam_ana_pop.css">
	<script src="js/jquery-1.7.1.min.js"></script>
	<script src="js/jquery.reveal.js"></script>
<style>
.Get_Year green close{margin:auto auto;text-align:center;width:200px;height:60px;color:#FFFFFF;background-color:#006699;border:#003366 1px solid;cursor:pointer;}
</style>
<script type="text/javascript">
function getHttpRequest()
{
if(window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
return xmlhttp;
}
function showHint(str,name)
{
var xmlhttp;    
if ((name=="Zone"&&str=="Type the zone")||(name=="District"&&str=="Type the district"))
  {
  document.getElementById("List").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
   document.getElementById("List").innerHTML=xmlhttp.responseText;
    }
  }
  str=str+","+name;
xmlhttp.open("GET","gethint.php?q="+str,true);
xmlhttp.send();
}
function fill(val)
{
var boxd=document.forms["graph_inp"]["District"].value; 
var boxz=document.forms["graph_inp"]["Zone"].value; 	
if(boxz!="Type the zone")
{
document.graph_inp.Zone.value=val;
var xmlhttp; 
var ana=document.forms["graph_inp"]["Zone"].value;
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
   document.getElementById("exam_nam").innerHTML=xmlhttp.responseText;
    }
  }
  var str="Zone,"+ana;
xmlhttp.open("GET","exam_name_graph.php?q="+str,true);
xmlhttp.send();
}
if(boxd!="Type the district")
{
document.graph_inp.District.value=val;
var xmlhttp; 
var ana=document.forms["graph_inp"]["District"].value; 
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
   document.getElementById("exam_nam").innerHTML=xmlhttp.responseText;
    }
  }
  var str="District,"+ana;
xmlhttp.open("GET","exam_name_graph.php?q="+str,true);
xmlhttp.send();
}
document.getElementById("List").innerHTML="";
document.getElementById("ok").innerHTML="";
}

</script>
<script type="text/javascript">
function cleartbox(name)
{	
	document.getElementById(name).value="";	
	if(name=="Zone")
	{
	document.getElementById("Zone").value="";
    document.getElementById("District").value="Type the district";	
	}
if(name=="District")
	{
	document.getElementById("District").value="";
    document.getElementById("Zone").value="Type the zone";	

	}	
}
</script>
<script type="text/javascript">
function get_Okbutton(str)
{
var xmlhttp; 
var exa=document.forms["graph_inp"]["Exam_Name"].value; 
var boxd=document.forms["graph_inp"]["District"].value; 
var boxz=document.forms["graph_inp"]["Zone"].value; 	
if(boxz!="Type the zone")
{
var ana="Zone";
var ana_val=boxz;
}
if(boxd!="Type the district")
{
var ana="District";
var ana_val=boxd;
}
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
   document.getElementById("ok").innerHTML=xmlhttp.responseText;
    }
  }
    var str=exa+","+str+","+ana+","+ana_val;
xmlhttp.open("GET","Okbutton.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function getExaSubject(str)
{
var xmlhttp;    
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
   document.getElementById("exam_Subject").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","get_subject_graph.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function get_graph_year(str)
{
var xmlhttp;    
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
   document.getElementById("pop_up").innerHTML=xmlhttp.responseText;
    }
  }
 xmlhttp.open("GET","get_year_popup.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript">
function showData(str)
{
var xmlhttp;    
if (str=="Select One")
  {
  document.getElementById("pichart").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("pichart").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","getpichart.php?q="+str,true);
xmlhttp.send();
}
</script>
<script type="text/javascript" src="popup-window.js"></script>
<?php
include_once ("../Login/databaseconnection.php");

if(!loggedin())
{
	require_once ("../index.php");
}
   
   else
   {
   ?>

</head>
<body>
<?php
if(isset($_POST['submit']))
{
	require_once 'csvread.php';
}
?>
<?php
include_once "../header2.php";
?>
<?php
include_once "topmenu.php";
?> 
<div id="content">
	<div id="main">
	  <div id="bodyfield">
<br/>
<table width="978" height="392" class="tablefontv">
<tr>
  <td>&nbsp;</td>
  <td height="18" colspan="3" class="err"> 
<?php
 include_once ("../uploerror.php");

if(isset($_SESSION['errorinuploading']))
{
echo '<img src="../images/alert.jpg" width="12" height="12"/>';
echo $_SESSION['errorinuploading'];
unset($_SESSION['errorinuploading']);
}
if(isset($_SESSION['errordata']))
{
echo '<img src="../images/alert.jpg" width="12" height="12"/>';
echo $_SESSION['errordata'];
unset($_SESSION['errordata']);
}
if(isset($_SESSION['errorexi']))
{
echo $_SESSION['errorexi'];
unset($_SESSION['errorexi']);
}
if(isset($_SESSION['insertsucc']))
{
echo '<img src="../images/alert.jpg" width="12" height="12"/>';
echo $_SESSION['insertsucc'];
unset($_SESSION['insertsucc']);
}
?>
		</td>
  <td></td>
  <td width="552" rowspan="4">
  <img src="<?php echo "$basedir";?>/images/exam.png" width="550" height="330" alt="Image" style="border: solid 1px #D6E0E2; box-shadow: inset 0px 0px 0px 1px #fff; border: 0; -webkit-box-shadow:	inset 0px 1px 0px #fff, 0px 1px 1px rgba(0,0,0,.15); -moz-box-shadow: inset 0px 1px 0px #fff, 0px 1px 1px rgba(0,0,0,.15); box-shadow: inset 0px 1px 0px #fff, 0px 1px 1px rgba(0,0,0,.15); -webkit-border-radius:4px; -moz-border-radius:4px; border-radius:4px;"/></td>
</tr>
<tr>
  <td width="1" height="142">&nbsp;</td>
<td colspan="3"><h3>A test or exam(ination) is an assessment intended to measure a test-taker's knowledge, skill, aptitude, physical fitness, or classification in many other topics (e.g., beliefs). A test may be administered orally, on paper, on a computer, or in a confined area that requires a test taker to physically perform a set of skills.</h3></td>
<td width="1"></td>
</tr>
<tr>
  <td width="1" height="252" rowspan="2">&nbsp;</td>
  <td width="234" height="44" align="center"> <label>The Percentages of Passed Students of Schools on </label></td>
  <td width="152" align="center"><?php
       $Ye="";
	   $Ye=$_POST['Year'];
	   $Exam="";
	   $Exam=$_POST['Exam'];
	   ?>
    <form action="#" method="post">     
      <select name="Year" onChange="javascript:this.form.submit()">
        <?php
			if($Ye!="")
	  {
	  	  echo '<option value="'.$Ye.'">'.$Ye.'</option>';
	  }
	 	  else
	  {
	  echo '<option value="Select One">Select One</option>';
	  }
	  ?>
        <?php
	 $exa=mysql_query("SELECT DISTINCT(Year) FROM exam");	  
  while($row=mysql_fetch_array($exa))
  {
  $Yea=$row['Year'];
if($Ye!=$Yea)
{
	  echo '<option value="'.$Yea.'">'.$Yea.'</option>';
  }
	 }       
	  ?>
      </select>
      <?php
	   if($Ye=="Select One")
	   {
		   ?>
      <font class="err">
        <?php
		   echo "<br/>Please select the year of the Exam!";
		   ?>
        </font>
      <?php
	   }
	     if($Ye!="Select One"&&$Ye!="")
	   {
	   ?>
      <select name="Exam" onChange="javascript:this.form.submit()">
        <?php
			if($Exam!="")
	  {
	  	  echo '<option value="'.$Exam.'">'.$Exam.'</option>';
	  }
	 	  else
	  {
	  echo '<option value="Select One">Select One</option>';
	  }
	  ?>
        <?php
	 $exa=mysql_query("SELECT DISTINCT(Exam_Name) FROM exam WHERE Year='".$Ye."'");	  
  while($row=mysql_fetch_array($exa))
  {
  $exa_s=mysql_query("SELECT DISTINCT(Subject) FROM exam WHERE Exam_Name='".$row['Exam_Name']."' AND Year='".$Ye."'");	  
  while($rows=mysql_fetch_array($exa_s))
  {  
  $Subj=$rows['Subject'];
  $exam_n=$row['Exam_Name'].",".$Subj;
if($Exam!=$exam_n)
{
	  echo '<option value="'.$exam_n.'">'.$exam_n.'</option>';
  }
  }
	 }       
	  ?>
      </select>
      <?php
	   }
	   
	   if($Ye=="Select One"||$Exam=="Select One")
	   {
		   ?>
      <font class="err">
        <?php
		   echo "<br/>Please select the year and Exam!";
		   ?>
        </font>
      <?php
	   }
	     if($Ye!="Select One"&&$Ye!=""&&$Exam!="Select One"&&$Exam!="")
	   {
	   $par=$Ye.",".$Exam;	   
	   ?>
		<a href="getpichart.php?q=<?php echo $par; ?>" target="_blank">
        <input type="button" class="pichart"/>
        </a>
		<?php
		}
		?>
    </form></td>
  <td width="10" rowspan="2"></td>
<tr>
  <td height="155" colspan="3" align="center"></td>
</table>
  
</div>
</div>
</div>
<div id="sidebar"><br/>
<div id="partners" class="boxed">
			<h2 class="title">EXAMS</h2>
            </div>
			<div id="pop_up"></div>
         <?php
 include_once ("uploform.php");
?> 
<?php
include_once "menu.php";
?>
 <?php
include_once "../footer.php";
}
?>

</body>
</html>